home *** CD-ROM | disk | FTP | other *** search
Text File | 1991-03-06 | 1.8 KB | 67 lines | [TEXT/GEOL] |
- Item forwarded by A33 to A34
-
- Item 7819184 30-Nov-89 07:31
-
- From: DEREK White, Derek
-
- To: MACAPP.TECH$ MacApp Technical
-
- Sub: Pascal 3.1(re More on Uses)
-
- James, Tseung, and fellow MacAppers,
-
- Your statements about mutual dependencies in objects are correct for MPW
- Pascal 3.0. There are some major problems with that scheme however.
- Mis-spelled types are assumed to be forward object types for instance:
- TObj = OBJECT
- fEmpty: bboolean; {<= assumed to be a forward object }
- END;
-
- For MPW 3.1 and beyond, the prefered way of implementing forward object
- references in the more explicit:
-
- UNIT UTest;
- TYPE
- TSecond = OBJECT; FORWARD;
-
- TFirst = OBJECT
- fSecond: TSecond;
- END; { TFirst }
-
- TSecond = OBJECT
- fFirst: TFirst;
- END; { TSecond }
- END.
-
- Eventually the current, implicit forward object references will be
- disallowed (the -forward option turns off implicit forward objects in 3.1).
- You will also be able to seperate object declarations into different units
- using the EXTERNAL modifier:
-
- UNIT UFirst;
- USES USecond;
- TYPE
- TSecond = OBJECT; EXTERNAL; {must declare external because USecond
- uses me}
- TFirst = OBJECT
- fSecond: TSecond;
- END;
- END.
-
- UNIT USecond;
- USES UFirst;
- TYPE
- TFirst = OBJECT; EXTERNAL; {must declare external because UFirst
- uses me}
- TSecond = OBJECT
- fFirst: TFirst;
- END;
- END.
-
- By declaring the mutually referenced classes EXTERNAL in BOTH units, the order
- of using and compiling the units doesn't matter so much. This should bring a
- little more sense to the wacky world of mutual dependancies. Call APDA for
- availibility of MPW 3.1.
- - Derek White
-
-